package p2.jduplessy.exercise20140606.test;
import static org.junit.Assert.*;

import java.util.Arrays;
import java.util.Scanner;

import org.junit.Test;

import p2.jduplessy.exercise20140606.core.Person;


public class testPerson {

	@Test
	public void test() {

		Scanner in = new Scanner(System.in);
		Person[] personArray = new Person[20];		
		int personCount=0;

		while (true) {

			System.out.println("1) Ingresar datos");
			System.out.println("2) Mostrar datos");
			System.out.println("3) Salir.");

			switch (Integer.parseInt(in.next())) {

				case 1:					
					
					personCount++;
					personArray[personCount] = new Person();				
					
					System.out.println("Ingrese el nombre: ");
					personArray[personCount].setName(in.next());

					System.out.println("Ingrese el apellido:");
					personArray[personCount].setLastName(in.next());

					break;

				case 2:
					for (Person elem : personArray) {
						if (elem != null){
							System.out.println(elem.getLastName() + ", " + elem.getName());						
						}
						
					}
					break;

				case 3:
					System.exit(0);
					break;

				default:
					System.out.println("...Opcion Incorrecta! vuelva a ingresar.\n\n");
					break;

			}

		}

	}

}
